package com.triones.framework.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * 通用是否数值
 *
 * @author triones
 * 2023-09-19
 */
@Getter
@AllArgsConstructor
public enum BooleanNumberEnum {
    /**
     *
     * 否
     */
    NO("否", 0),
    /**
     * 是
     */
    YES("是", 1),
    ;

    private String info;
    private Integer code;

    public static BooleanNumberEnum convert(Integer code) {
        return Stream.of(values()).filter(o -> o.getCode().equals(code)).findFirst().orElse(NO);
    }
}
